From e535c7b1c8042339a93cee629bbc41a511e324b6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 7 Oct 2014 12:01:10 -0700 Subject: [PATCH] Use the right package for doc test variables --- src/cargo/ops/cargo_test.rs | 7 +++---- tests/test_cargo_test.rs | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cargo/ops/cargo_test.rs b/src/cargo/ops/cargo_test.rs index 3a2b61fc3..387b32751 100644 --- a/src/cargo/ops/cargo_test.rs +++ b/src/cargo/ops/cargo_test.rs @@ -15,7 +15,6 @@ pub fn run_tests(manifest_path: &Path, test_args: &[String]) -> CargoResult> { let mut source = try!(PathSource::for_path(&manifest_path.dir_path())); try!(source.update()); - let package = try!(source.get_root_package()); let mut compile = try!(ops::compile(manifest_path, &mut options.compile_opts)); if options.no_run { return Ok(None) } @@ -27,7 +26,7 @@ pub fn run_tests(manifest_path: &Path, Some(path) => path, None => exe.clone(), }; - let cmd = compile.process(exe, &package).args(test_args); + let cmd = compile.process(exe, &compile.package).args(test_args); try!(options.compile_opts.shell.concise(|shell| { shell.status("Running", to_display.display().to_string()) })); @@ -51,12 +50,12 @@ pub fn run_tests(manifest_path: &Path, for (lib, name) in libs { try!(options.compile_opts.shell.status("Doc-tests", name)); - let mut p = compile.process("rustdoc", &package) + let mut p = compile.process("rustdoc", &compile.package) .arg("--test").arg(lib) .arg("--crate-name").arg(name) .arg("-L").arg(&compile.root_output) .arg("-L").arg(&compile.deps_output) - .cwd(package.get_root()); + .cwd(compile.package.get_root()); // FIXME(rust-lang/rust#16272): this should just always be passed. if test_args.len() > 0 { diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index 0fd300518..fd11bd361 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -1122,8 +1122,12 @@ test!(selective_testing_with_docs { name = "d1" version = "0.0.1" authors = [] + + [lib] + name = "d1" + path = "d1.rs" "#) - .file("d1/src/lib.rs", ""); + .file("d1/d1.rs", ""); p.build(); assert_that(p.process(cargo_dir().join("cargo")).arg("test") -- 2.30.2